<!--
 * @Descripttion: 
 * @version: 
 * @Author: sueRimn
 * @Date: 2022-07-11 10:34:35
 * @LastEditors: sueRimn
 * @LastEditTime: 2022-07-15 16:55:15
-->
<template>
  <div>
    <h3>孙组件</h3>
    <p>props:{{ pChild3 }}</p>
    <p>$attrs:{{ $attrs }}</p>
  </div>
</template>

<script>
export default {
  name: "child2",
  data() {
    return {};
  },
  props: ["pChild3"],
  inheritAttrs: false,
  created() {
    this.$emit("test3");
  },
  mounted() {
    console.log("chlild2 $attrs ", this.$attrs, this.$attrs.pChild4); //不能通过this.$attrs.pChild4访问属性
    // this.pChild3 = "111";//错误 子组件不能修改父组件传递过来的值
    this.$emit("test4");
    this.$emit("test2");
  },
};
</script>
